package com.bawei.base.view

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.blankj.utilcode.util.ToastUtils

/**
 * Author: Jason Zhang
 * Date: 2025/4/22
 * Desc: 基础Activity
 */
abstract class BaseActivity<VDB : ViewDataBinding> : AppCompatActivity(){

    protected lateinit var mDataBinding: VDB


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //获取布局绑定代理对象
        mDataBinding = DataBindingUtil.setContentView(this, getLayoutId())
        //初始化View
        initViews()
    }

    protected fun showToast(msg: String) {
        if (msg.isNullOrEmpty()){
            ToastUtils.showLong(msg)
        }
    }

    protected abstract fun getLayoutId(): Int

    protected open fun initViews(){

    }

}